<?php
namespace mvc\validator;

class IntValidator extends Validator
{
    public function validate()
    {
        if (!preg_match('/^\s*[+-]?\d+\s*$/', $this->value)) {
            $this->message = $this->attributeLabel . '必须为整数';
            return false;
        }
        return true;
    }

    public function getMessage()
    {
        return $this->message;
    }
}